From: Ryan Schmidt Date: Mon, 13 Oct 2008 02:18:49 +0000 (+0000) Subject: * re-implement r41983 (forgot to add log message). Changes made: X-Git-Tag: 1.31.0-rc.0~44771 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=4f655ca3bab21a88fc758f7079a45e45fb529f54;p=lhc%2Fweb%2Fwiklou.git * re-implement r41983 (forgot to add log message). Changes made: ** handling fixes: use DoubleReplacer class instead of create_function(), moving recursiveTagParse above line-break replacements, removed strip items, updated parser tests to reflect new output when combined with --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index d951a02466..c1c18a89dc 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4190,23 +4190,20 @@ class Parser */ $nl = array_key_exists( 'compact', $param ) ? '' : "\n"; - $tag = $this->insertStripItem( "
", $this->mStripState ); + $replacer = new DoubleReplacer( ' ', ' ' ); + $text = $this->recursiveTagParse( $in ); + $text = $this->mStripState->unstripNoWiki( $text ); // Only strip the very first and very last \n (which trim cannot do) - $text = $in; - if( substr( $in, 0, 1 ) == "\n" ) - $text = substr( $in, 1 ); + if( substr( $text, 0, 1 ) == "\n" ) + $text = substr( $text, 1 ); if( substr( $text, -1 ) == "\n" ) $text = substr( $text, 0, -1 ); - $text = str_replace( "\n", "$tag\n", $text ); + $text = str_replace( "\n", "
\n", $text ); $text = preg_replace_callback( "/^( +)/m", - create_function( - '$matches', - 'return str_replace(" ", " ", "$matches[0]");' - ), + $replacer->cb(), $text ); - $text = $this->recursiveTagParse( $text ); // Pass HTML attributes through to the output. $attribs = Sanitizer::validateTagAttributes( $param, 'div' ); @@ -4218,7 +4215,7 @@ class Parser $attribs['class'] = 'poem'; } - return XML::openElement( 'div', $attribs ) . $nl . trim( $text ) . $nl . XML::closeElement( 'div' ); + return Xml::openElement( 'div', $attribs ) . $nl . trim( $text ) . $nl . Xml::closeElement( 'div' ); } function getImageParams( $handler ) { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 20876f2e8f..5f5f54fc85 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -7234,9 +7234,7 @@ test this
is
a
-test
- -

+test

!!end @@ -7256,9 +7254,7 @@ test this
'''is'''
a
-test
- -

+test

!! end